package com.oracle.rentcar;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;
import javax.xml.crypto.Data;

@MapperScan("com.oracle.rentcar.mapper") //扫描mapper接口所在包
@SpringBootApplication
public class RentcarApplication {
    public static void main(String[] args) {
        SpringApplication.run(RentcarApplication.class, args);
    }

    @Bean
    public MultipartConfigElement multipartConfigElement(){
        MultipartConfigFactory factory = new MultipartConfigFactory();

        //上传单个文件大小最大为20MB
        factory.setMaxFileSize(DataSize.ofMegabytes(20L));

        //上传多个文件大小最大为1GB
        factory.setMaxRequestSize(DataSize.ofGigabytes(1L));

        return factory.createMultipartConfig();
    }
}
